#pragma once

#include "MTESrl.h"

#include <map>

class MICEXTable;

class MICEXTableKey
{
public:
	MICEXTableKey();
	MICEXTableKey(const MICEXTableKey& compKey);
	MICEXTableKey(MICEXTable* pTable, int nFields, BYTE* pFieldBuf, int32 nDataLen, BYTE* pDataBuf);
	virtual ~MICEXTableKey();

public:

	bool operator < (const MICEXTableKey& compKey) const
	{
		return (memcmp(pData.get(), compKey.pData.get(), Size) < 0);
	}

	void operator = (const MICEXTableKey& compKey)
	{
		pTable	= compKey.pTable;
		Size		= compKey.Size;
		
		
		pData = std::auto_ptr<BYTE>(new BYTE[Size]);

		memcpy(pData.get(), compKey.pData.get(), Size);
	}

public:
	MICEXTable*	pTable;
	int32			Size;
	std::auto_ptr<BYTE> pData;
};

typedef std::map<MICEXTableKey, int>	TABLEKEYMAPTOPOSITION;
